import React from 'react';
import {WeaTable} from 'ecCom';

class Setting extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            dataSource: []
        };
        // 将当前组件实例传递到元素组件，以便元素组件获取到该组件
        props.getInstance && props.getInstance(this);
        this.onSave = this.onSave.bind(this);
    }

    componentWillMount() {
        console && console.log(this.props);
    }

    render() {
        const {dataSource} = this.state;

        const columns = [{
            key: 'title',
            title: '标题',
            width: '60%',
        }, {
            key: 'operation',
            title: '操作',
            width: '40%',
        }];

        return (
            <div className="portal-cus-ele-demo-setting">
                <WeaTable columns={columns} dataSource={dataSource}/>
            </div>
        );
    }

    onSave() {
        // 设置保存
        console && console.log('onSave');
    }
}

export default Setting;
